home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
serial
/
callback.001
/
callback~
/
callback
/
lib
/
user
/
lastusergroup.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-07-18
|
538b
|
23 lines
#include "user.p"
int lastusergroup(int gi)
{
USER_
*up;
unsigned
idx;
up = &user[nusers - 1]; /* points to last user */
for (idx = 0; idx < up->ngroups; idx++)
{
if (up->groups[idx] == gi) /* group already exists ? */
return (0); /* then done */
}
/* store the new group-index */
up->groups = xrealloc(up->groups, (++up->ngroups) * sizeof(unsigned));
up->groups[idx] = gi; /* store the new groupindex */
return (1); /* its's a new group */
}